Let's start by learning about
monolithic application. In software engineering, this describes
a single-tiered software application. Here, the user interface and the data access code are combined into
a single program from a single platform. A monolithic application
is self-contained and independent from other
computing applications. It is deployed as a single
monolithic application. In case it's a Java Web application, then it will have a single WAR file that
runs on a web container such as Tomcat. Now, let's see a pictorial representation of the working of a ride
share application. In this application,
you currently have four services, starting with the user authentication
service, the passenger management service, the billing service and
the notification service. These services use a web container,
Tomcat, to interact with database. Imagine the complexity involved if you
need to extend the number of services and add a driver management service,
trip management service and many more. The actual problem is not
the number of services present in the monolithic application, but
the interactions between them. Now, let's see the impact on
a monolithic application if the changes are to be incorporated in it. The whole development, release and deployment management cycle will have
to be implemented all over again. There is also a severe complexity
related to the change impact. Small changes in the existing
components can have a ripple effect as the components are interconnected and
dependent on one another. To implement the change in
the application and make it live, we need to shut down the entire
application, take it offline, perform the changes, test the application
and then make it live again. To deploy a bug fix in one of
the components in the application, the entire application
should be redeployed. Let's understand the disadvantages
of monolithic applications. Tight coupling between components. Monolithic components become
tightly coupled and entangled. This coupling affects management,
scalability and continuous deployment. Overloaded web container. The larger the application,
the longer it takes to start up. This has a huge impact on
developers productivity because of the time wasted waiting for
the container to start. It also impacts deployment. Large code base makes it tough for
developers and QA to understand the code and
business knowledge. Less scalable. A monolithic application is also
an obstacle to scaling development. Once the application gets to a certain
size, it is useful to divide up the engineering organization into teams
that focus on specific functional areas. For example,
we might want to have a UI team, an accounting team,
an inventory team and many more. The trouble with a monolithic application
is that it prevents the teams from working independently. The teams must coordinate their
development efforts and redeployments. It is much more difficult for a team
to make a change and update production. Obstacles in continuous deployment. A large monolithic application is
an obstacle to frequent deployments. To update one component,
you must redeploy the entire application. This will interrupt background tasks. For example, Quartz jobs and
a Java application, regardless of whether they are impacted by
the change, can possibly cause problems. There is also the chance that components
that haven't been updated will fail to start correctly. As a result, the risk associated
with redeployment increases, which discourages frequent updates. This is especially a problem for
user interface developers as they usually need to iterate rapidly and
redeploy frequently. More deployment and restart times. The size of the application makes it
slow and even a minor change results in redeployment of the whole resulting in
increased restart and redeployment time. New technology barriers are encountered. Any change in language and framework
ends up affecting the whole application. This can prove to be costly in
terms of time as well as money. Long-term commitment to a tech stack. A monolithic architecture forces you to
be married to the technology stack and in some cases, to a particular
version of that technology that you choose at the start of development. With a monolithic application, it can be difficult to incrementally
adapt to a newer technology. You have few language choices,
including Java, which supports monolithic architecture. For example, you can use JVM languages
that inter operate nicely with Java, such as Groovy and Scala. But components written
in non JVM languages do not have a place within your
monolithic architecture. Also, if your application uses
a platform framework that subsequently becomes obsolete, then it can be
challenging to incrementally migrate the application to a newer and
better framework. It's possible that in order to
adopt a newer platform framework, you have to rewrite the entire
application, which is a risky undertaking. Now, as you have seen the disadvantages
of monolithic applications, to make it more user friendly and
easily accessible, you can shift from
monolithic to microservices. This image shows the pictorial difference
in their respective processes. A monolithic application puts all its
functionalities into a single process, such as the image on screen, in which different functionalities
are put into one process. After putting the functionalities
into one process, you perform scaling by replicating the monolith on
multiple servers as shown here. Now, coming to the microservices,
the architecture puts each element of functionality into a separate
service as portrayed here, which is completely different
from a monolithic application. After this is done, you perform scaling by distributing these services across
servers, replicating as needed. This portrays the flexibility you
have in microservices as compared to monolithic applications.